public class TestHint {
    public static void main(String[] args) {
		
		Einstein einstein = new Einstein(6);
		NextTo nextTo = new NextTo();
		LeftOf leftOf = new LeftOf();
		Between between = new Between();
		Vertical vertical = new Vertical();
				
		String[] pattern = {"1","2","3","4","5","6",
							"A","B","C","D","E","F",
							"I","II","III","IV","V","VI",
							"!","@","#","$","%","&",
							".",":","/","::","*","||",
							"a","b","c","d","e","f"};
		einstein.setUnits(pattern);
		
		//System.out.println(einstein.getUnits());
		Unit[] hintUnit = new Unit[2];

//		int[] hintarr = {0,11,14,0,0,10,1,1,13,0,3,4,1,10,6,1,7,12,0,14,5,1,8,11,2,2,7};
//		for(int i=0; i<hintarr.length; i+=3){
//			hintUnit[0] = einstein.getUnit(hintarr[i+1]);
//			hintUnit[1] = einstein.getUnit(hintarr[i+2]);
//			einstein.addHint(hintarr[i], hintUnit);
//		}
//		hintUnit = new Unit[3];
//		hintUnit[0] = einstein.getUnit(8);
//		hintUnit[1] = einstein.getUnit(3);
//		hintUnit[2] = einstein.getUnit(13);
//		einstein.addHint(3, hintUnit);
		

		String[] hintarr = {"#","|","D",
							"VI","|","e",
							"III","|","b",
							"c","|",".",
							"@","|","IV",
							":","|","A",
							
							"d","5","%",
							"1","^","&",
							"a","^","@",
							"b","^","::",
							
							":","^","3",
							"%",">","VI",
							"2",">","B",
							"F","C","6",
							
							"II","2","::",
							"e","d","c",
							"!","^","I",
							":","^","1",
							
							"a",">","#",
							"||","c","V",
							"6",">","*",
							"F",">","d"
							};

		einstein.loadHints(hintarr);

		System.out.println(einstein.getHints());
		
		einstein.getUnit(0).setBits("100000");
		einstein.printUnitGrid();
		
		int i = 0;
		do{
			einstein.walkHints();
			System.out.println();
			einstein.printUnitGrid();
			i++;
		}while(!einstein.allFound() && !einstein.hasEmpty() && i<20);
		if(einstein.allFound()){
			System.out.println("Solution found in "+i+" cycles");
		}else{
			System.out.println("Hints FAILED after "+i+" cycles");
		}
		
		
		
		
//		Unit unitA = new Unit(6,new Character('A'));
//		Unit unitB = new Unit(6,new Character('B'));
//		Unit unitC = new Unit(6,new Character('C'));
//
//		unitA.randomState();
//		unitB.randomState();
//		unitC.randomState();
//		
//		System.out.println(unitA);
//		System.out.println(unitB);
//		System.out.println(unitC);
//       
//		System.out.println(vertical.checkHint(unitA, unitB));
//		vertical.applyHint(unitA, unitB);
//		System.out.println(unitA);
//		System.out.println(unitB);
//		System.out.println(unitC);
    }
}